<?php
	include_once('auth.php');
	
	include_once('config.php');
?>
<!DOCTYPE html>
<html>
	<head>
		<title>weZze-admin</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
        <link rel="shortcut icon" href="/favicon.ico" />
        <link href="css/style.css" rel="stylesheet" type="text/css" media="screen" />
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen" />
        <script type = "text/javascript" src = "http://code.jquery.com/jquery-1.7.2.js"></script>
        <script type = "text/javascript" src = "js/script.js"></script>
        <script type = "text/javascript" src = "js/bootstrap.min.js"></script>
		<script type = "text/javascript" src = "js/tipsy.js"></script>
	</head>
	
	<body>
		<div class = "row-fluid show-grid logoutButton">
			<div class = "span1 offset11"><a href = "?do=logout"><span class="label label-info">Выйти</span></a></div>
		</div>
		<div class = "row-fluid show-grid">
			<div class = "span8">
<?php
			$tags = getAllTags();
?>
				<h4>Все теги:</h4>
				<table id = "tagsTable" class = "table table-striped table-bordered table-condensed">
					<tr>
						<th>
							#
						</th>
						<th>
							Имя тега
						</th>
						<th>
							Транслитерация
						</th>
						<th>
							Удалить
						</th>
					</tr>
					
<?php
					if (is_array($tags) > 0)
					{
						$i = 1;
						foreach ($tags as $one_tag)
						{
?>
					<tr>
						<td>
							<?= $i; ?>
						</td>
						<td>
							<?= $one_tag['ru_name']; ?>
						</td>
						<td>
							<?= $one_tag['en_name']; ?>
						</td>
						<td class = "align_center">
							<i class="icon-remove delTag"></i>
							<input type = "hidden" name = "tagID" value = "<?= $one_tag['id']; ?>" />
						</td>
					</tr>		
<?php
							$i++;
						}
					}
?>
				</table>
			</div>
			
			<div class = "span4">
				<div id = "addVideoDiv">
					<div class = "sendData"></div>
					<form name = "addTag" id = "addTagForm" url = "add_tag_controller.php">
						<h4>Добавить тег:</h4>
							<table id = "addTagTable" url = 'add_tag_controller.php'>
								<tr class = "control-group">
									<th>Тег:</th>
									<td><input type = "text" name = "tName" class = "required" /></td>
								</tr>
								<tr class = "control-group">
									<th>Транслитерация:</th>
									<td><input type = "text" name = "tTranslate" class="required" /></td>
								</tr>
								<tr>
									<td colspan = 2><label class = "checkbox tagAdminCheckbox"><input name = "tMain" type = "checkbox" value = "1">Основной</label></td>
								</tr>
								<tr>
									<td colspan = 2 class = "align_right"><button type = "submit" class = "btn btn-primary">Добавить</button></td>
								</tr>
								<tr>
									<td colspan = 2 class = "align_left"><a href = "/admin/video.php" original-title="Перейти на страницу создания видео" class = "tipsyLink">Добавить видео</a></td>
								</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>